﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace truongServer
{
    public partial class frmConnectToServerCapCao : Form
    {
        public frmConnectToServerCapCao(string url,string port)
        {
            InitializeComponent();
            txtAddress.Text = url;
            txtPort.Text = port;
        }

        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtAddress.Text.Trim()) && !string.IsNullOrEmpty(txtPort.Text.Trim()))
            {
                Hashtable myInfor = new Hashtable();
                myInfor["port"] = txtPort.Text.Trim();
                myInfor["url"] =  txtAddress.Text.Trim();
                updateAdmin up = new updateAdmin();
                up.writeXML(myInfor);
                this.DialogResult = DialogResult.OK;
            }
            else MessageBox.Show("Vui lòng điền đầy đủ thông tin server cấp cao.");
        }

        private void frmConnectToServerCapCao_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }
        protected override CreateParams CreateParams
        {
            get
            {
                var cp = base.CreateParams;
                cp.ExStyle |= 0x80;  // Turn on WS_EX_TOOLWINDOW
                return cp;
            }
        }
    }
}
